<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改实体用况')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-interface-edit" th:object="${interfaceInfo}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">接口名称：</label>
                <div class="col-sm-8">
                    <input name="interfaceName" th:field="*{interfaceName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">接口描述：</label>
                <div class="col-sm-8">
                    <textarea name="interfaceDescription" class="form-control">[[*{interfaceDescription}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">接口地址：</label>
                <div class="col-sm-8">
                    <input name="interfaceUrl" th:field="*{interfaceUrl}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">前后类型：</label>
                <div class="col-sm-8">
                    <select name="fbType" id="fbType" class="form-control m-b" th:with="type=${@dict.getType('fbType')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fbType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">操作类型：</label>
                <div class="col-sm-8">
                    <select name="optType" class="form-control m-b" th:with="type=${@dict.getType('optType')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{optType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group" id="interfaceTypeDiv">
                <label class="col-sm-3 control-label">接口类型：</label>
                <div class="col-sm-8">
                    <select name="interfaceType" id="interfaceType" class="form-control m-b" th:with="type=${@dict.getType('interfaceType')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{interfaceType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否分页：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                        <input type="radio" th:id="${'isPage_' + dict.dictCode}" name="isPage" th:value="${dict.dictValue}" th:field="*{isPage}">
                        <label th:for="${'isPage_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">总条数：</label>
                <div class="col-sm-8">
                    <input name="total" th:field="*{total}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">页数：</label>
                <div class="col-sm-8">
                    <input name="page" th:field="*{page}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">每页大小：</label>
                <div class="col-sm-8">
                    <input name="pageSize" th:field="*{pageSize}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">非功能需求：</label>
                <div class="col-sm-8">
                    <textarea name="nonFunctionalRequirements" class="form-control">[[*{nonFunctionalRequirements}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "interface/interface";
        $("#form-interface-edit").validate({
            focusCleanup: true
        });

        if ($("#fbType").val() == '1') {
            $("#interfaceTypeDiv").hide();
        } else {
            $("#interfaceTypeDiv").show();
        }

        $("#fbType").change(function () {
            if ($(this).val() == '1') {
                $("#interfaceTypeDiv").hide();
            } else {
                $("#interfaceTypeDiv").show();
            }
        })

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-interface-edit').serialize());
            }
        }
    </script>
</body>
</html>